import { request } from 'umi';

export interface LoginParamsType {
  username: string;
  password: string;
  phone: string;
  smsCode: string;
  type: string;
}

export async function fakeAccountLogin(params: LoginParamsType) {
  return request<API.LoginResp>('/api/doLogin', {
    method: 'POST',
    data: params,
  });
}

export async function getFakeCaptcha(mobile: string) {
  return request(`/api/sendCode?mobile=${mobile}`, {
    method: 'POST',
  });
}

export async function registerAccount(params: LoginParamsType) {
  return request<API.LoginResp>('/api/register', {
    method: 'POST', 
    data: params,
  })
}

export async function outLogin() {
  return request('/api/logout');
}
